import matplotlib.pyplot as plt
#支持中文
plt.rcParams['font.family'] = ['sans-serif']
plt.rcParams['font.sans-serif'] = ['SimHei']
# 数据准备
x = [1, 2, 3, 4, 5]
y = [2, 3, 5, 7, 11]
# 创建图形
plt.figure(figsize=(8, 6))
plt.plot(x, y, 
         label="示例折线", 
         color="blue", 
         linestyle="--", 
         marker="o",
         linewidth=2,
         markersize=8)
# 添加标题和标签
plt.title("示例折线图", fontsize=14)
plt.xlabel("X轴", fontsize=12)
plt.ylabel("Y轴", fontsize=12)
# 添加图例和网格
plt.legend(fontsize=10)
plt.grid(True, linestyle=':', alpha=0.7)
# 显示图形
plt.show()
